<?php

/**************************************************************
 *
 *	使用特定function对数组中所有元素做处理
 *	@param	string	&$array		要处理的字符串
 *	@param	string	$function	要执行的函数
 *	@return boolean	$apply_to_keys_also		是否也应用到key上
 *	@access public
 *
 *************************************************************/
function arrayRecursive(&$array, $function, $apply_to_keys_also = false)
{
	static $recursive_counter = 0;
	if (++$recursive_counter > 1000) {
		die('possible deep recursion attack');
	}
	foreach ($array as $key => $value) {
		if (is_array($value)) {
			arrayRecursive($array[$key], $function, $apply_to_keys_also);
		} else {
			$array[$key] = $function($value);
		}

		if ($apply_to_keys_also && is_string($key)) {
			$new_key = $function($key);
			if ($new_key != $key) {
				$array[$new_key] = $array[$key];
				unset($array[$key]);
			}
		}
	}
	$recursive_counter--;
}


?>
<html>
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 </head>
<style>
textarea {
	width: 100%;
	overflow: auto;
	word-break: break-all;
}

li {
	margin: 20px;
}
</style>
<script type="text/javascript" src="jquery.js"></script>
<script>
function format(txt,compress/*是否为压缩模式*/){/* 格式化JSON源码(对象转换为JSON文本) */  
    var indentChar = '    ';   
    if(/^\s*$/.test(txt)){   
        alert('数据为空,无法格式化! ');   
        return;   
    }   
    try{var data=eval('('+txt+')');}   
    catch(e){   
        alert('数据源语法错误,格式化失败! 错误信息: '+e.description,'err');   
        return;   
    };   
    var draw=[],last=false,This=this,line=compress?'':'\n',nodeCount=0,maxDepth=0;   
       
    var notify=function(name,value,isLast,indent/*缩进*/,formObj){   
        nodeCount++;/*节点计数*/  
        for (var i=0,tab='';i<indent;i++ )tab+=indentChar;/* 缩进HTML */  
        tab=compress?'':tab;/*压缩模式忽略缩进*/  
        maxDepth=++indent;/*缩进递增并记录*/  
        if(value&&value.constructor==Array){/*处理数组*/  
            draw.push(tab+(formObj?('"'+name+'":'):'')+'['+line);/*缩进'[' 然后换行*/  
            for (var i=0;i<value.length;i++)   
                notify(i,value[i],i==value.length-1,indent,false);   
            draw.push(tab+']'+(isLast?line:(','+line)));/*缩进']'换行,若非尾元素则添加逗号*/  
        }else   if(value&&typeof value=='object'){/*处理对象*/  
                draw.push(tab+(formObj?('"'+name+'":'):'')+'{'+line);/*缩进'{' 然后换行*/  
                var len=0,i=0;   
                for(var key in value)len++;   
                for(var key in value)notify(key,value[key],++i==len,indent,true);   
                draw.push(tab+'}'+(isLast?line:(','+line)));/*缩进'}'换行,若非尾元素则添加逗号*/  
            }else{   
                    if(typeof value=='string')value='"'+value+'"';   
                    draw.push(tab+(formObj?('"'+name+'":'):'')+value+(isLast?'':',')+line);   
            };   
    };   
    var isLast=true,indent=0;   
    notify('',data,isLast,indent,false);   
    return draw.join('');   
}  
function servicesubmit(sender){
	document.getElementById("p").value=document.getElementById(sender).value;
	if($("#methodtype").attr('checked')){
		$("#formid").attr("method","post").attr("target","_blank");
	}
	else{
		$("#formid").attr("method","get").attr("target","_self");
	}
}
function farea(sender){
	try{
		var a=format(document.getElementById(sender).value);
		if(a!=undefined && a!=null && a!="")
		document.getElementById(sender).value=a;
		$("textarea").each(function(){ $(this).css("height",$(this).attr("scrollHeight")); });
	}
	catch(exp){
		alert(exp.message);
	}
}
</script>
<button type="button" onclick="farea('resulttext');">格式化</button>
<br />
<textarea
	style="border: 1px solid #DEDEDE; word-break: break-all; padding: 5px;"
	id="resulttext"></textarea>
<form id="formid" action="ServiceService.php?XDEBUG_SESSION_START=ECLIPSE_DBGP"
	method="post"><input type="hidden" id="p" name="p" /><input type="hidden" id="alert" value="alert" name="alert" /> <input
	type="hidden" name="returnurl" value="test.php" /> <label><input
	type="radio" name="result" value="alert"
	<?php if(!empty($_GET["result"])){ ?> checked <?php }?> />不加密</label>
<label><input type="radio" name="result" value=""
	<?php if(empty($_GET["result"])){ ?> checked <?php }?> />加密</label>
	<label><input type="radio" id="methodtype" value="post" />Post</label>
<ul>
	<li><textarea id="getpassword">{"op":"getpassword","tel":"18562555268","code":"1234","newpsw":"123456","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('getpassword');">找回密码</button>
	<button type="button" onclick="farea('getpassword');">格式化</button>
	<br />
	</li>
	<li><textarea id="password">{"op":"password","oldpsw":"123456","newpsw":"123456","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('password');">修改密码</button>
	<button type="button" onclick="farea('password');">格式化</button>
	<br />
	</li>
	<li><textarea id="MessageList">{"op":"MessageList","row":"0","size":"12","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('MessageList');">消息列表</button>
	<button type="button" onclick="farea('MessageList');">格式化</button>
	<br />
	</li>
<li><textarea id="orderposition">{"op":"orderposition","o_tid":"1","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('orderposition');">获取订单洗车工位置</button>
	<button type="button" onclick="farea('orderposition');">格式化</button>
	<br />
	</li>
	<li><textarea id="orderinfo">{"op":"orderinfo","o_tid":"1","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('orderinfo');">洗车工订单详情</button>
	<button type="button" onclick="farea('orderinfo');">格式化</button>
	<br />
	</li>
<li><textarea id="orderinfo">{"op":"orderinfo","o_tid":"1","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('orderinfo');">客户订单详情</button>
	<button type="button" onclick="farea('orderinfo');">格式化</button>
	<br />
	</li>
<li><textarea id="carorderlist">{"op":"carorderlist","row":"0","size":"1","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('carorderlist');">洗车工订单列表</button>
	<button type="button" onclick="farea('carorderlist');">格式化</button>
	<br />
	</li>
	<li><textarea id="orderlist">{"op":"orderlist","row":"0","size":"1","o_status":"未完成","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('orderlist');">客户订单列表</button>
	<button type="button" onclick="farea('orderlist');">格式化</button>
	<br />
	</li>
<li><textarea id="removecollectuser">{"op":"removecollectuser","item_id":"1","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('removecollectuser');">取消收藏洗车工</button>
	<button type="button" onclick="farea('removecollectuser');">格式化</button>
	<br />
	</li>
<li><textarea id="collectuser">{"op":"collectuser","item_id":"1","keyword":"收藏收藏","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('collectuser');">收藏洗车工</button>
	<button type="button" onclick="farea('collectuser');">格式化</button>
	<br />
	</li>
<li><textarea id="carwasharea">{"op":"carwasharea","lng":120.333,"lat":36.66,"rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('carwasharea');">附近洗车工</button>
	<button type="button" onclick="farea('carwasharea');">格式化</button>
	<br />
	</li>
<li><textarea id="washwaiting">{"op":"washwaiting","oa_tid":"10","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('washwaiting');">等待接单</button>
	<button type="button" onclick="farea('washwaiting');">格式化</button>
	<br />
	</li>
<li><textarea id="washcancel">{"op":"washcancel","oa_tid":"10","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('washcancel');">取消洗车请求</button>
	<button type="button" onclick="farea('washcancel');">格式化</button>
	<br />
	</li>
<li><textarea id="washinfo">{"op":"washinfo","oa_tid":"10","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('washinfo');">洗车请求明细</button>
	<button type="button" onclick="farea('washinfo');">格式化</button>
	<br />
	</li>
<li><textarea id="washlist">{"op":"washlist","row":"0","size":"5","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('washlist');">洗车请求列表</button>
	<button type="button" onclick="farea('washlist');">格式化</button>
	<br />
	</li>
	<li><textarea id="vhcservice">{"op":"vhcservice","vid":"1","rnd":"323121321398","uid":0,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('vhcservice');">获取车辆最后申请项目</button>
	<button type="button" onclick="farea('vhcservice');">格式化</button>
	<br />
	</li>
<li><textarea id="userlocation">{"op":"userlocation","lng":120.333,"lat":36.66,"rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('userlocation');">我要接单（申请列表）</button>
	<button type="button" onclick="farea('userlocation');">格式化</button>
	<br />
	</li>
	<li><textarea rows="" cols="" id="getuser">{"op":"getuser","a":"ykadmin","p":"123456","r":[{"province":"山东省","city":"青岛","district":"李沧区" ,"street":"李村"}],"rnd":"323121321398","uid":0,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('getuser');">接口测试</button>
	</li>
	<li><textarea id="authcode">{"op":"authcode","t":"13687617749","type":"注册","rnd":"323121321398","uid":0,"version":"1.0","system":"android","opdt":"20150505120133"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('authcode');">获取验证码</button>
	<button type="button" onclick="farea('authcode');">格式化</button>
	<br />
	</li>
	<li><textarea id="valicode">{"op":"valicode","t":"13687617749","c":"10878","type":"注册","rnd":"323121321398","uid":0,"version":"1.0","system":"android","opdt":"20150505120133"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('valicode');">验证验证码</button>
	<button type="button" onclick="farea('valicode');">格式化</button>
	<br />
	</li>
	<li><textarea id="reg">{"op":"reg","t":"13687617749","c":"41181","p":"123456","r":[{"province":"山东省","city":"青岛","district":"李沧区" ,"street":"李村"}],"rnd":"323121321398","uid":0,"version":"1.0","system":"android","opdt":"20150505120133"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('reg');">用户注册</button>
	<button type="button" onclick="farea('reg');">格式化</button>
	</li>
	<li><textarea id="login">{"op":"login","a":"ykadmin","p":"123456","r":[{"province":"山东省","city":"青岛","district":"李沧区" ,"street":"李村"}],"rnd":"323121321398","uid":0,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('login');">用户登录</button>
	<button type="button" onclick="farea('login');">格式化</button>
	<br />
	</li>
	<li><textarea id="edituser">{"op":"edituser","birthday":"2015-06-02 00:00","user_id":"1","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('edituser');">修改用户信息</button>
	<button type="button" onclick="farea('edituser');">格式化</button>
	<br />
	</li>
	<li><textarea id="getservices">{"op":"getservices","r":[{"province":"山东省","city":"青岛","district":"李沧区" ,"street":"李村"}],"rnd":"323121321398","uid":0,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('getservices');">通过区域获取服务价格和车型价格</button>
	<button type="button" onclick="farea('getservices');">格式化</button>
	<br />
	</li>
	<li><textarea id="orderapply">{"op":"orderapply","type":0,"vehicle":1,"lng":120.333,"lat":36.66,"position":"青岛市市南区香港中路6号","r":[{"province":"山东省","city":"青岛","district":"李沧区" ,"street":"李村"}],"attr":"attr","reserve_date":"20150505132301","note":"捎话","tip":"10","foruserid":"0","items":[{"oas_item_id":1,"oas_item":"整车","oas_price":10}],"rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('orderapply');">我要洗车</button>
	<button type="button" onclick="farea('orderapply');">格式化</button>
	<br />
	</li>
	<li><textarea id="vhcmodel">{"op":"vhcmodel","rnd":"323121321398","uid":0,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('vhcmodel');">车辆类型</button>
	<button type="button" onclick="farea('vhcmodel');">格式化</button>
	<br />
	</li>

	<li><textarea id="getpaytype">{"op":"getpaytype","rnd":"323121321398","uid":0,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('getpaytype');">支付方式</button>
	<button type="button" onclick="farea('getpaytype');">格式化</button>
	<br />
	</li>
	<li><textarea id="addresstype">{"op":"addresstype","rnd":"323121321398","uid":0,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('addresstype');">常用地址类型</button>
	<button type="button" onclick="farea('addresstype');">格式化</button>
	<br />
	</li>
	<li><textarea id="getaddr">{"op":"getaddr","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('getaddr');">取得常用地址</button>
	<button type="button" onclick="farea('getaddr');">格式化</button>
	<br />
	</li>

	<li><textarea id="addaddr">{"op":"addaddr","ca_tid":"0","addr":"青岛市市南区香港中路6号","r":[{"province":"山东省","city":"青岛","district":"李沧区" ,"street":"李村"}],"type":"家","lat":"36.33","lng":"120.56","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('addaddr');">添加或编辑常用地址</button>
	<button type="button" onclick="farea('addaddr');">格式化</button>
	<br />
	</li>
	<li><textarea id="moveaddr">{"op":"moveaddr","id":"1","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('moveaddr');">移除常用地址</button>
	<button type="button" onclick="farea('moveaddr');">格式化</button>
	<br />
	</li>
	<li><textarea id="vehiclebrand">{"op":"vehiclebrand","row":"0","size":"1","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('vehiclebrand');">车辆品牌</button>
	<button type="button" onclick="farea('vehiclebrand');">格式化</button>
	<br />
	</li>
	<li><textarea id="vehiclebrandmodel">{"op":"vehiclebrandmodel","vbtid":"1","row":"0","size":"1","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('vehiclebrandmodel');">车辆品牌型号</button>
	<button type="button" onclick="farea('vehiclebrandmodel');">格式化</button>
	<br />
	</li>
	<li><textarea id="vehicleedit">{"op":"vehicleedit","v_tid":"0","v_code":"鲁B00000","v_brand":"一汽奥迪","v_model":"TT","v_type":"跑车","v_color":"白色","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('vehicleedit');">添加或编辑车辆</button>
	<button type="button" onclick="farea('vehicleedit');">格式化</button>
	<br />
	</li>
	<li><textarea id="vehicledel">{"op":"vehicledel","v_tid":"0","v_code":"鲁B00000","v_brand":"一汽奥迪","v_model":"TT","v_type":"跑车","v_color":"白色","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('vehicledel');">移除车辆</button>
	<button type="button" onclick="farea('vehicledel');">格式化</button>
	<br />
	</li>
	<li><textarea id="createorder">{"op":"createorder","id":"1","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('createorder');">创建订单</button>
	<button type="button" onclick="farea('createorder');">格式化</button>
	<br />
	</li>
	<li><textarea id="carwashworkon">{"op":"carwashworkon","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('carwashworkon');">洗车工上班</button>
	<button type="button" onclick="farea('carwashworkon');">格式化</button>
	<br />
	</li>
	<li><textarea id="carwashworkoff">{"op":"carwashworkoff","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('carwashworkoff');">洗车工下班</button>
	<button type="button" onclick="farea('carwashworkoff');">格式化</button>
	<br />
	</li>
	<li><textarea id="carwashworklist">{"op":"carwashworklist","row":"0","size":"12","rnd":"323121321398","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
	<br />
	<button type="submit" onclick="servicesubmit('carwashworklist');">洗车上下班列表</button>
	<button type="button" onclick="farea('carwashworklist');">格式化</button>
	<br />
	</li>
</ul>
</form>
<script>
document.getElementById("resulttext").innerHTML=(eval("'" + '<?php echo str_replace("'","\"",$_GET["r"]);?>' + "'"));
</script>
</html>
